package com.suncreate.zhtz.iot.service.impl;

import com.suncreate.zhtz.iot.model.ScOcrThalesMotorOil;
import com.suncreate.zhtz.iot.dao.ScOcrThalesMotorOilDao;
import com.suncreate.zhtz.iot.service.ScOcrThalesMotorOilService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 泰雷兹雷达状态监测采集器(ScOcrThalesMotorOil)表服务实现类
 *
 * @author makejava
 * @since 2021-09-13 14:09:58
 */
@Service("scOcrThalesMotorOilService")
public class ScOcrThalesMotorOilServiceImpl implements ScOcrThalesMotorOilService {
    @Resource
    private ScOcrThalesMotorOilDao scOcrThalesMotorOilDao;

    /**
     * 通过ID查询单条数据
     *
     * @param dtime 主键
     * @return 实例对象
     */
    @Override
    public ScOcrThalesMotorOil queryById(Date dtime) {
        return this.scOcrThalesMotorOilDao.queryById(dtime);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<ScOcrThalesMotorOil> queryAllByLimit(int offset, int limit) {
        return this.scOcrThalesMotorOilDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param scOcrThalesMotorOil 实例对象
     * @return 实例对象
     */
    @Override
    public ScOcrThalesMotorOil insert(ScOcrThalesMotorOil scOcrThalesMotorOil) {
        this.scOcrThalesMotorOilDao.insert(scOcrThalesMotorOil);
        return scOcrThalesMotorOil;
    }

    /**
     * 修改数据
     *
     * @param scOcrThalesMotorOil 实例对象
     * @return 实例对象
     */
    @Override
    public ScOcrThalesMotorOil update(ScOcrThalesMotorOil scOcrThalesMotorOil) {
        this.scOcrThalesMotorOilDao.update(scOcrThalesMotorOil);
        return this.queryById(scOcrThalesMotorOil.getDtime());
    }

    /**
     * 通过主键删除数据
     *
     * @param dtime 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Date dtime) {
        return this.scOcrThalesMotorOilDao.deleteById(dtime) > 0;
    }
}
